<template>
  <div class="seal" :class="`${model || 'rect'} ${curStatus.code}`">
    {{curStatus.label}}
  </div>
</template>
<script setup>
const props = defineProps({
  status:{ // Success Fail
    type: String,
    required: true,
    value: 'Success' | 'Fail' | 'Cancel'
  },
  model:{ // circle rect
    type: String,
    value: 'circle' | 'rect'
  }
})

import { onMounted, ref } from 'vue'
const statusMap = {
  Success: { label: '成功', code: 'success' },
  Fail: { label: '失败', code: 'fail' },
  Cancel: { label: '撤单', code: 'cancel' }
}
let curStatus = ref({})

const init = () => {
  curStatus.value = statusMap[props.status] || {}
}
onMounted(init)


</script>
<style lang="scss" scoped>
.seal{
    position: absolute;
    color: transparent;
    display: grid;
    place-content: center;
    text-align: center;
    font-size: 12px;
    border: 2px solid transparent;
    opacity: 0.5;
    // outline: 4px solid #07c160;
    outline-offset: 5px;
    font-weight: 600;
    font-size: 12px;
    &.circle{
      transform: rotate(-30deg);
      width: 50px;
      height: 50px;
      border-radius: 50%;
    }
    &.rect{
      display: inline-block;
      border-radius: 5px;
      padding: 0 15px;
      transform: rotate(-15deg);
    }

    &.success{
      color:#07c160;
      border-color: #07c160;
    }
    &.fail{
      color:#ee0a24;
      border-color: #ee0a24;
    }
    &.cancel{
      color:#B4B4B4;
      border-color: #B4B4B4;
    }
}

.seal-rect {
    --red: #d00;
    display: inline-block;
    border: solid .1em var(--red);
    border-radius: .2em;
    color: var(--red);
    content: 'Draft';
    font-size: 50px;
    font-weight: bold;
    line-height: 1;
    opacity: 0;
    padding: .1em .5em;
    text-transform: uppercase;
    transform: rotate(-2deg) scale(5);
    animation: seal .3s cubic-bezier(0.6, 0.04, 0.98, 0.335) forwards;
}
@keyframes seal {
    100% {
        opacity: .75;
        transform: rotate(-15deg) scale(1);
    }
}
</style>